package main.od;

import java.util.Scanner;

public class SunMaxTest {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] strs = scanner.nextLine().split(",");
        int len = strs.length;
        long res = 0;
        for (int i = 0;i < len - 1;i++){
            for (int j = i;j < len;j++){
                long a = Long.parseLong(strs[i]);
                long b = Long.parseLong(strs[j]);
                long c = j - i;
                if (a > b){
                    if (res < b*c){
                        res = b*c;
                    }
                }else {
                    if (res < a*c){
                        res = a*c;
                    }
                }
            }
        }
        System.out.println(res);
    }
}
